package com.ly.common.running.service;

import com.ly.common.business.util.SpringContextUtil;
import com.ly.common.running.impl.IBaseFlowHandle;
import com.ly.common.running.impl.IFlow;
import com.ly.common.running.model.BaseInOut;
import org.springframework.stereotype.Service;

/**
 * @author luoyana
 * @version V1.0
 * @ClassName AbstractFlow
 * @description flow实现
 * @update 2023/6/8
 */
@Service
public class AbstractFlow<In extends BaseInOut,Out extends BaseInOut> implements IBaseFlowHandle<In,Out> {
    @Override
    public Out execute(In in,String beanName,Class<Out> outClass) {
        IFlow flow = (IFlow)SpringContextUtil.applicationContext.getBean(beanName);
        return (Out) flow.handle(beanName,in,outClass);
    }

    @Override
    public String getKey() {
        return "Flow";
    }
}
